# SPDX-License-Identifier: GPL-2.0

#
# This file is part of Lustre, http://www.lustre.org/
#

MODULES = libcfs


libcfs_dir := $(dir $(lastword $(MAKEFILE_LIST)))

libcfs-compat-objs :=

COMPAT_SCHED := @top_srcdir@/lustre_compat/kernel/sched/
include $(libcfs_dir)/../../lustre_compat/kernel/sched/Makefile
libcfs-compat-objs += $(patsubst %,$(COMPAT_SCHED)%,$(sched_objs))

COMPAT_MM := @top_srcdir@/lustre_compat/mm/
include $(libcfs_dir)/../../lustre_compat/mm/Makefile
libcfs-compat-objs += $(patsubst %,$(COMPAT_MM)%,$(mm_objs))

COMPAT_LIB := @top_srcdir@/lustre_compat/lib/
include $(libcfs_dir)/../../lustre_compat/lib/Makefile
libcfs-compat-objs += $(patsubst %,$(COMPAT_LIB)%,$(lib_objs))


libcfs-linux-objs := linux-prim.o

EXTRA_DIST = $(libcfs-compat-objs:.o=.c)

libcfs-crypto-objs := crypto.o fname.o hkdf.o hooks.o keyring.o
libcfs-crypto-objs += keysetup.o keysetup_v1.o policy.o

default: all

libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
libcfs-crypto-objs := $(addprefix crypto/,$(libcfs-crypto-objs))

libcfs-all-objs := debug.o fail.o module.o tracefile.o

libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs) $(libcfs-compat-objs)
@LLCRYPT_TRUE@libcfs-objs += $(libcfs-crypto-objs)

EXTRA_PRE_CFLAGS := -I@LUSTRE@/../libcfs/libcfs

@INCLUDE_RULES@
